package cn.com.gdt.microservice.auths.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import cn.com.gdt.microservice.auths.api.RMService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/auths")
@Api("权限管理")
public class RMController {
	@Autowired
	private RMService rmService;
	
	@RequestMapping(value="getUserBelongOrg/{id}",method={RequestMethod.GET,RequestMethod.POST})
	@ApiOperation(value="获取用户所属组织", notes="根据用户id获取所属组织信息")
	public Map<String,Object> getUserBelongOrg(@PathVariable String id){
		return rmService.getUserBelongOrg(id);
	}
	
	@RequestMapping(value="getUserInfoByUserId/{id}",method={RequestMethod.GET,RequestMethod.POST})
	@ApiOperation(value="获取用户信息", notes="根据用户id获取用户信息")
	public Map<String,Object> getUserInfoByUserId(@PathVariable String id){
		return rmService.getUserInfo(id);
	}
	
	@RequestMapping(value="getOrgInfoByOrgId/{id}",method={RequestMethod.GET,RequestMethod.POST})
	@ApiOperation(value="获取组织信息", notes="根据组织id获取组织信息")
	public Map<String,Object> getOrgInfoByOrgId(@PathVariable String id){
		return rmService.getOrgInfo(id);
	}
	@RequestMapping(value="getUserInfoList",method={RequestMethod.GET,RequestMethod.POST})
	@ApiOperation(value="获取用户信息列表", notes="获取用户信息列表")
	public List<Map<String,Object>> getUserInfoList(){
		return rmService.getUserInfoList();
	}
	@RequestMapping(value="getOrgInfoList",method={RequestMethod.GET,RequestMethod.POST})
	@ApiOperation(value="获取组织信息列表", notes="获取组织信息列表")
	public List<Map<String,Object>> getOrgInfoList(){
		return rmService.getOrgInfoList();
	}
}
